<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->increments('id');
            $table->string('user_name', 30)->default('')->comment('用户名');
            $table->char('user_pass', 60)->default('')->comment('用户密码');
            $table->string('user_nickname', 30)->default('')->comment('昵称');
            $table->string('user_avartar', 150)->default('')->comment('用户头像');
            $table->string('user_email', 50)->default('')->comment('安全邮箱');
            $table->char('user_tel', 11)->default('')->comment('安全手机');
            $table->enum('user_sex', ['男','女'])->default('男')->comment('性别');
            $table->integer('user_gold')->default(0)->comment('用户金币');
            $table->dateTime('user_birthday')->default('2016-07-04 00:00:00')->comment('生日');
            $table->dateTime('user_regtime')->comment('创建时间');
            $table->dateTime('user_logintime')->nullable()->comment('最后登录时间');
            $table->char('user_loginip', 16)->nullable()->comment('最后登录ip');
            $table->tinyInteger('user_status')->default(1)->comment('用户状态，0禁用用户,1正常登录,-1是已删除用户');
            $table->index(['user_name', 'user_email']);
            $table->index('user_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('user');
    }
}
